<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="/WEB-INF/jsp/include/head.jsp"/>
</head>
<body>

<body>
<ol class="breadcrumb">
    <li><strong>当前位置： </strong>标准化管理</li>
    <li class="active">修改密码</li>
</ol>

<div    style="margin-top: 100px">
    <div class="form-horizontal row ">
        <form id="form_data">

            <div class="form-group col-sm-12 ">
                <label class="control-label col-sm-5">原密码：</label>
                <div class="  col-sm-3">
                    <input type="password" class="form-control  " name='oldPassword'>
                </div>
            </div>
            <div class="form-group col-sm-12 ">
                <label class="control-label col-sm-5">新密码：</label>
                <div class="  col-sm-3">
                    <input type="password" class="form-control  " name="newPassword">
                </div>
            </div>

            <div class="form-group  col-sm-12 ">
                <label class="control-label col-sm-5">确认密码：</label>
                <div class="col-sm-3">
                    <input type="password" class="form-control" name="newPassword2">
                </div>
            </div>


            <div class="form-group col-sm-12 ">
                <div class="col-sm-3 col-sm-offset-5">
                    <button type="submit"
                            class="btn btn-default btn-success"><span
                            class="glyphicon glyphicon-ok"></span>&nbsp;确&nbsp;定&nbsp;
                    </button>
                </div>
            </div>
            <div  class="form-group col-sm-12 " >
                <div id="div_error" class="col-sm-3 col-sm-offset-5">

                </div>
            </div>
        </form>
    </div>
</div>

<jsp:include page="/WEB-INF/jsp/include/footer.jsp"/>

<script>

    $(function () {

        <%--bootstrapValidator--%>
        $("#form_data").bootstrapValidator({
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                oldPassword: {
                    validators: {
                        notEmpty: {
                            message: '不能为空！'
                        },
                        stringLength: {
                            max: 40,
                            message: '原密码太长！'
                        }, different: {
                            field: 'newPassword',
                            message: '原密码和新密码不能相同！'
                        }
                    }
                }
                , newPassword: {
                    validators: {
                        notEmpty: {
                            message: '不能为空！'
                        },
                        stringLength: {
                            max: 40,
                            message: '新密码太长！'
                        }, different: {
                            field: 'oldPassword',
                            message: '新密码和原密码不能相同！'
                        }
                        , identical: {
                            field: 'newPassword2',
                            message: '新密码和确认密码不一致'
                        }
                    }
                }, newPassword2: {
                    validators: {
                        notEmpty: {
                            message: '不能为空！'
                        },
                        stringLength: {
                            max: 40,
                            message: '确认密码太长！'
                        }, identical: {
                            field: 'newPassword',
                            message: '确认密码和新密码不一致'
                        }

                    }
                }

            }
        }).on('success.form.bv', function (e) {
            e.preventDefault();
          
            $.sysPlugin.superAjax({
                data:  $(e.target).serialize(),
                url: 'upms/resetPassword/setPassword',
                operateType: "update",
                showSuccessAlert: true,
                showWarnAlert: false,
                successCall: function (data) {
                    window.history.go(0);
                },
                errorCall: function (data) {
                    $.sysPlugin.errorCallBack(data, {
                        form: $("#form_data")
                    })
                }
            })




        });
    });

</script>


</body>
</html>